<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); 

// @TODO: Get results only where they are set to active

class Homepage_model extends CI_Model
{
	// Protected or private properties
	protected $_table;
	
	// Constructor
	public function __construct()
	{
		parent::__construct();		
		$this->_table = $this->config->item('database_tables');
	}
	
	public function get_featured_product()
	{
		$this->db->select('id, product_name, alias, description, created_by, category_id, hit, icon, featured, status, price');
		$this->db->where('featured', 1);
		$this->db->where('status', 1);
		$this->db->limit(18);
		$query = $this->db->get('product');
		return $query->result_array();
	}
	
	public function get_game_android_product()
	{
		$this->db->select('product.id, product.product_name, product.alias, product.category_id,
		product.icon, product.price, product.hit, product.status');
		$this->db->where('product.app_id', 1);
		$this->db->where('product.status', 1);
		$this->db->limit(18);
		$query = $this->db->get('product');
		return $query->result_array();
	}
	
	public function get_new_product()
	{
		$this->db->select('product.id, product.product_name, product.alias, product.category_id,
		product.icon, product.price, product.hit, product.status');
		$this->db->limit(18);
		$this->db->order_by('product.id', 'desc');
		$this->db->where('product.status',1);
		$query = $this->db->get('product');
		return $query->result_array();
	}
	
	public function get_featured_product_mobile()
	{
		$this->db->select('id, product_name, alias, description, created_by, category_id, hit, icon, featured, status, price');
		$this->db->where('featured', 1);
		$this->db->where('status', 1);
		$this->db->limit(5);
		$query = $this->db->get('product');
		return $query->result_array();
	}
	
	public function get_game_android_product_mobile()
	{
		$this->db->select('product.id, product.product_name, product.alias, product.category_id,
		product.icon, product.price, product.hit, product.status');
		$this->db->where('product.app_id', 1);
		$this->db->where('product.status', 1);
		$this->db->limit(5);
		$query = $this->db->get('product');
		return $query->result_array();
	}
	
	public function get_new_product_mobile()
	{
		$this->db->select('product.id, product.product_name, product.alias, product.category_id,
		product.icon, product.price, product.hit, product.status');
		$this->db->limit(5);
		$this->db->order_by('product.id', 'desc');
		$this->db->where('product.status',1);
		$query = $this->db->get('product');
		return $query->result_array();
	}
	
	// start use for iphone template
	public function get_new_product_iphone()
	{
		$this->db->select('*');
		$this->db->limit(12);
		$this->db->order_by('id', 'desc');
		$this->db->where('status',1);
		$this->db->where('app_id',2);
		$query = $this->db->get('product');
		return $query->result_array();
	}
	
	public function get_featured_product_iphone()
	{
		$this->db->select('id, product_name, description, created_by, app_id, category_id, hit, icon, featured, status, price');
		$this->db->where('featured', 1);
		$this->db->where('status', 1);
		$this->db->where('app_id',2);
		$this->db->limit(12);
		$query = $this->db->get('product');
		return $query->result_array();
	}
	
	// end use for iphone template
	// =============================
	// = ========== GET ========== =
	// =============================
	
	/**
	 * Get all Categories
	 *
	 * @access	public
	 * @return 	object	Categories
	 */
}
// END homepage_model.php
/* Location: ./application/modules/home/models/homepage_model.php */